package com.ihisun.tmhcms.controller.openingcontroller;


import com.ihisun.tmhcms.core.dto.searchvipnumberdto.SearchVipNumberDto;
import com.ihisun.tmhcms.core.dto.searchvipnumberdto.VipNumberDeliver;
import com.ihisun.tmhcms.core.service.openingrecordservice.OpeningRecordService;
import com.ihisun.tmhcms.core.vo.OpeningRecordVo;
import com.ihisun.tmhcms.utils.ResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags = "开通记录项目Api")
@RequestMapping("/opening")
public class OpeningController {

    @Resource
    OpeningRecordService openingRecordService;

    @PostMapping("/findByOpening")
    @ApiOperation(value = "开通记录列表",response =OpeningRecordVo.class)
    public ResponseVo findByOpening(@RequestBody SearchVipNumberDto searchVipNumberDto){
        ResponseVo byOpeningRecord = openingRecordService.findByOpeningRecord(searchVipNumberDto);
        return byOpeningRecord;
    }

    @GetMapping("/orderInfo")
    @ApiOperation(value = "订单详情",response = OpeningRecordVo.class)
    @ApiImplicitParam(name = "orderId",value = "订单id",dataType = "String" ,paramType = "query")
    public ResponseVo orderInfo(String orderId){
        ResponseVo responseVo = openingRecordService.orderInfo(orderId);
        return responseVo;
    }
    @PostMapping("/deliverGoods")
    @ApiOperation(value = "发货")
    public ResponseVo deliverGoods(@RequestBody VipNumberDeliver vipNumberDeliver){
        ResponseVo responseVo = openingRecordService.deliverGoods(vipNumberDeliver);
        return responseVo;
    }
}
